package com.bestcem.xm.om.grpc.service.converter;

import com.bestcem.xm.om.entity.OmUserOperateLog;
import com.bestcem.xm.om.grpc.v1.services.CreateOperateLogRequest;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * grpc请求出入参转化类
 *
 * @author zhangfeng <feng.zhang@idiaoyan.com>
 * @version v1.0
 * @date 2022/6/22 14:45
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class OperateLogConverter {
    /**
     * grpc请求入参转换成本地入参
     *
     * @param request
     * @return com.bestcem.xm.om.entity.OmUserOperateLog
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/6/22 14:54
     */
    public static OmUserOperateLog requestToParam(CreateOperateLogRequest request) {
        OmUserOperateLog omUserOperateLog = new OmUserOperateLog();
        omUserOperateLog.setUserId(request.getUserId());
        omUserOperateLog.setCategory(request.getCategoryValue());
        omUserOperateLog.setOperation(request.getOperationValue());
        omUserOperateLog.setOperateId(request.getOperateId());
        omUserOperateLog.setTargetId(request.getTargetId());
        omUserOperateLog.setMsg(request.getMsg());
        omUserOperateLog.setInformation(request.getInfo());
        return omUserOperateLog;
    }
}
